package com.hr.reactive.hotAndcold;

import com.hr.base.A;
import com.hr.reactive.common.Utils;
import reactor.core.publisher.Flux;

import java.util.concurrent.atomic.AtomicInteger;

public class Lec01ColdPublisher {
    public static void main(String[] args) {
        AtomicInteger atomicInteger=new AtomicInteger(0);
        Flux<Object> objectFlux = Flux.create(fluxSink -> {
            for (int i = 0; i < 3; i++) {
                fluxSink.next(atomicInteger.incrementAndGet());
            }
            fluxSink.complete();
        });
        objectFlux.subscribe(Utils.subscriber("1"));
        objectFlux.subscribe(Utils.subscriber("2"));
    }
}
